package com.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.model.auto.RecruitInfo;
import com.service.IRecruitInfoService;
import com.util.Page;
import com.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 招聘信息Controller
 * @author zhaoyifan
 * @date 2024/7/19 14:53
 */
@RestController
@RequestMapping("/recruitInfo")
public class RecruitInfoController {

    @Autowired
    private IRecruitInfoService recruitInfoService;


    /**
     * 获取招聘信息
     *
     * @param page
     * @param name
     * @return
     */
    @GetMapping("/list")
    public R list(Page page, String name) {
        List<RecruitInfo> list = recruitInfoService.list(new LambdaQueryWrapper<RecruitInfo>()
                .eq(StringUtils.hasText(name), RecruitInfo::getName, name)
                .orderByAsc(RecruitInfo::getNum));
        return R.ok(list);
    }
}
